package com.dk.service.impl;

import com.dk.mapper.TAuthorMapper;
import com.dk.pojo.TAuthor;
import com.dk.pojo.TAuthorExample;
import com.dk.service.TAuthorServiceI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TAuthorServiceImpl implements TAuthorServiceI {

    @Autowired
    private TAuthorMapper tAuthorMapper;

    @Override
    public List<TAuthor> getInfoServer() {
        return tAuthorMapper.selectByExample(new TAuthorExample());
    }

    @Override
    public void saveById(TAuthor tAuthor) {
        tAuthorMapper.insertSelective(tAuthor);
    }

    @Override
    public TAuthor getUpdateInfo(Integer authorId) {
        return tAuthorMapper.selectByPrimaryKey(authorId);
    }

    @Override
    public void updateById(TAuthor tAuthor) {
        tAuthorMapper.updateByPrimaryKeySelective(tAuthor);
    }

    @Override
    public void deleteById(Integer authorId) {
        tAuthorMapper.deleteByPrimaryKey(authorId);
    }

    @Override
    public List<TAuthor> getInfo() {
        return tAuthorMapper.selectByExample(new TAuthorExample());
    }
}
